package edu.jd.movieplatform.user.feedback;

import edu.jd.movieplatform.common.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user/feedback")
public class FeedbackAPI {
    @Resource
    private FeedbackService Service;

    /**
     * 用户加反馈
     * 需要的参数：
     *     private String cust_username;
     *     private String feedback_text;
     */
    @PostMapping("/addFeedback")
    public Result addFeedback(@RequestBody FeedbackDto dto){
        boolean ok = Service.CreateFeedback(dto);
        if(ok){return Result.success();}
        return Result.fail(Result.ERR_CODE_BUSINESS,"反馈出错！");
    }

    @GetMapping("")
    public Result feedbackList(FeedbackDto dto){
        Map<String,Object> page = Service.findFeedbackList(dto);
        return Result.success(page);
    }
}
